<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="{$BASE_V}layout.css" rel="stylesheet" type="text/css" />
<title>TBlog博客系统</title>
<script type="text/javascript" src="{$BASE}js/tools.js"></script>
<script type="text/javascript" src="{$BASE_V}page.js"></script>
</head>
<body>

<div style="z-index: 1; right: 20px; top: 30px; color: rgb(255, 255, 255); position: absolute; display: none;" id="loading"><img src="{$BASE_V}images/loader.gif"></div>

<div id="main">
  <div class="main_box">    
<!--{if $action == 'add' }-->    
    <h2>添加案例赏析</h2>
	<form name="forms" id="forms" action="{PHP_SELF}?m=case.save" method="post"  onSubmit="return chkForm();">    
    <table width="100%" cellspacing="0" cellpadding="0" border="0" class="t_list">
      <tbody>
      <tr>
        <td class="td_right_f00" width="150">标题：</td>
        <td class="td_left" colspan="2"><input type="text" size="100" value="$editinfo[title]" id="title" name="title">
	  </td>
      </tr>
      
       <tr>
        <td class="td_right">选择分类：</td>
        <td class="td_left">
            <select name="cat_id" id="cat_id">
    			<option value="0">|-根分类</option>
				{$treers}
		    </select>	
        </td>
      </tr>      
      
      <tr>
        <td class="td_right">案例赏析图片：</td>
        <td class="td_left">
		<!--{if $editinfo[article_id]>0}-->
        {loop $imgurl_array $k $v}
        <div id="upload_div_$k">
        <span id="thumb_preview{$k}"><img src="$v" width="150" height="120" style="margin-bottom:6px"></span><br>
		地址：<input type="text" size="96" value="$v" id="thumb{$k}" name="thumb[]" readonly="readonly"><br>
        描述：<input type="text" size="96" value="$thumbtitle_array[$k]" name="thumbdes[]"><br>
		上传：<input type="file" onchange="image_preview('thumb{$k}',this.value,1)" style="width: 400px;" id="thumb_upload{$k}" name="thumb_upload{$k}">
		&nbsp;&nbsp;<input type="button" value="上传" onclick="return ajaxFileUpload('thumb_upload{$k}','/{PHP_SELF}?m=tool.upload&filename=thumb_upload{$k}','#thumb_loading{$k}', 'thumb{$k}', 'thumb_preview{$k}');" id="thumbupload{$k}" name="thumbupload{$k}">    <input type="button" value="删除" onclick="delimg('upload_div_{$k}')" />
		<img style="display:none;" src="{$BASE}js/loading.gif" id="thumb_loading{$k}">
        </div>
        <!--{/loop}-->
        <!--{else}-->
        <div id="upload_div">
        <span id="thumb_preview"></span><br>
		地址：<input type="text" size="96" value="" id="thumb" name="thumb[]" readonly="readonly"><br>
		描述：<input type="text" size="96" value="" name="thumbdes[]"><br>
		上传：<input type="file" onchange="image_preview('thumb',this.value,1)" style="width: 400px;" id="thumb_upload" name="thumb_upload">
		&nbsp;&nbsp;<input type="button" value="上传" onclick="return ajaxFileUpload('thumb_upload','/{PHP_SELF}?m=tool.upload&filename=thumb_upload','#thumb_loading', 'thumb', 'thumb_preview');" id="thumbupload" name="thumbupload">    <input type="button" value="删除" onclick="delimg('upload_div')" />
		<img style="display:none;" src="{$BASE}js/loading.gif" id="thumb_loading">
        </div>        
		<!--{/if}-->
        <div id="add_seriesArea"><input class="button" type="button" value="添加" onclick="add_seriesInit()"/></div>
		</td>
      </tr>

       <tr>
        <td class="td_right">作者：</td>
        <td class="td_left"><input type="text" value="$editinfo[author]" id="author" name="author"></td>
      </tr>
      
      <tr>
        <td class="td_right">排序：</td>
        <td class="td_left"><input type="text" value="$editinfo[order]" id="order" name="order"></td>
      </tr>

      <tr>
          <td class="td_right">关键字</td>
          <td class="td_left"> <input type="text" size="35" name="keywords" id="keywords" value="$editinfo[keywords]"> keywords</td>
      </tr>

      <tr>
          <td class="td_right">描述</td>
          <td class="td_left" colspan="2"><textarea id="description" rows="4" style="height:50px" cols="70" name="description">$editinfo[description]</textarea> description</td>
      </tr>  
      
      <tr>
        <td class="td_right">内容：</td>
        <td class="td_left">
		<textarea name="content" id="content" rows="60" cols="100" class="xheditor editor">$editinfo[content]</textarea>        
		</td>
      </tr>
      <tr>
        <td class="td_right">&nbsp;</td>
        <td class="td_left">
          <input type="hidden" name="aid" value="$editinfo[article_id]" />
          <input name="submit" type="submit" class="btn05" onmouseover="this.className='btn06'" onmouseout="this.className='btn05'" id="submit" value="提交" />
          <input type="reset" name="reset_button" value="清除" class="btn05" onmouseover="this.className='btn06'" onmouseout="this.className='btn05'">
          <input type="button" name="backbutton" id="backbutton" onClick="history.back(1);" value="返回" class="btn05" onmouseover="this.className='btn06'" onmouseout="this.className='btn05'"/></td>
      </tr>
    
    </form>
    </table>    
<script type="text/javascript" src="{$BASE}js/xheditor/jquery/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="{$BASE}js/xheditor/xheditor-1.1.7-zh-cn.min.js"></script>
<script type="text/javascript" src="{$BASE}js/ajaxfileupload.js"></script>
<script type="text/javascript" src="{$BASE}js/ThumbAjaxFileUpload.js"></script>
<script language="javascript">
jq = jQuery.noConflict(); 
//以后jquery中的都用jq代替即可。 
jq('#content').xheditor({upLinkUrl:"Public/uploadfiles/upload.php",upLinkExt:"zip,rar,txt",upImgUrl:"Public/uploadfiles/upload.php",upImgExt:"jpg,jpeg,gif,png",upFlashUrl:"Public/uploadfiles/upload.php",upFlashExt:"swf",upMediaUrl:"Public/uploadfiles/upload.php",upMediaExt:"avi"});
function chkForm()
{
	if($('title').value == ""){
	   alert("请填写标题！");   
	   $('title').focus();
	   return(false);
   	}
	
	if($('cat_id').value == "0"){
	   alert("请选择分类！");   
	   $('cat_id').focus();
	   return(false);
   	}		
	
	if($('thumb').value == ""){
	   alert("请上传图片！");   
	   $('thumb').focus();
	   return(false);
   	}
	if(jq('#content').val() == ""){

   	}		
}

    function add_seriesInit(){	
	//获取了页面所有的file
	 var file = jq(':file').get();                        
	 var fileNum = file.length; 	
	 var id = fileNum+1;
	 var fileName = 'thumb[]'; 

     var thumbStr = '<div id="upload_div_'+id+'"><span id="thumb_preview'+id+'"></span><br>地址：<input type="text" size="96" value="" id="thumb'+id+'" name="'+fileName+'" readonly="readonly"><br>描述：<input type="text" size="96" value="" name="thumbdes[]"><br>上传：<input type="file" onchange="image_preview(\'thumb'+id+'\',this.value,1)" style="width: 400px;" id="thumb_upload'+id+'" name="thumb_upload'+id+'">&nbsp;&nbsp;<input type="button" value="上传" onclick="return ajaxFileUpload(\'thumb_upload'+id+'\',\'/{PHP_SELF}?m=tool.upload&filename=thumb_upload'+id+'\',\'#thumb_loading'+id+'\', \'thumb'+id+'\', \'thumb_preview'+id+'\');" id="thumbupload'+id+'" name="thumbupload'+id+'">    <input type="button" value="删除" onclick="delimg(\'upload_div_'+id+'\')" /><img style="display:none;" src="{$BASE}js/loading.gif" id="thumb_loading'+id+'"></div>';
      jq("#add_seriesArea").before(thumbStr);                       
    };
	
	function delimg(id){
		jq("#"+id+"").remove();
	}
</script>
<!--{/if}-->
    
<!--{if $action == 'index' }-->
    <h2>案例赏析列表</h2>
<form name="list_form" method="POST" action="{PHP_SELF}?m=case.del&case={$pageCurrent}" onSubmit="return checkDelForm();">
    <table width="100%" cellspacing="0" cellpadding="0" border="0" class="t_list">
      <tbody><tr>
      <th>&nbsp;</th>
        <th width="10%">编号</th>
        <th width="60%">标题</th>
        <th width="17%">时间</th>        
        <th width="10%">管理</th>
      </tr>
	  <!--{if $ErrorMsg}-->
	  <tr>
	    <td height=23 colspan=7 class=forumRowHigh align=center>$ErrorMsg</td>
	  </tr>
	  <!--{/if}-->      
      <!--{loop $rs $k $v}-->
      <tr onmouseout="this.style.background='#fff'" onmouseover="this.style.background='#f6f9fd'" style="background: none repeat scroll 0% 0% rgb(255, 255, 255);">
      
      <td><input type="checkbox" value="$v[article_id]" name="id_a[]"></td>
      <td>$v[article_id]</td>
      <td class="td_left">$v[title]</td> 
      <td>$v[time]</td> 
      <td><a href="{PHP_SELF}?m=case.add&amp;aid=$v[article_id]">修改</a>| <a href="{PHP_SELF}?m=case.del&amp;aid=$v[article_id]">删除</a></td>
      </tr>
      <!--{/loop}-->      
      <tr style="background: none repeat scroll 0% 0% rgb(248, 248, 248);">
              <td><input type="checkbox" name="select_all_btn" onclick="select_fx();"></td>
              <td class="td_left" colspan="6">
            <input type="submit" onclick="return confirm('确定要执行这次操作吗？')" class="btn02" value="删除所选" name="Submit">
            <input type="hidden" value="del" name="action">
      </td></tr>
      </tbody></table>
      </form>
      {$page}
<!--{/if}-->     


	</div>
</div>
</body>
</html>